//	ID : pallab81
// 	PROG : 967
// 	LANG : C++
// 	2011-09-09-14.29.56 Friday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define fo(i,st,ed) for(int i = st ; i < ed ; ++i )
#define foE(i,st,ed) for(int i = st ; i <= ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait( double seconds ){
    double endtime = clock()+( seconds* CLOCKS_PER_SEC );
    while( clock() < endtime ){
        ;
    }
}
const int inf = 1000000 ;
int st, ed;
int good[inf+10];
int primes[inf+10];
int curcular_primes[inf+10];

inline int toI(string ss){
    int d;
    sscanf(ss.c_str(),"%d",&d);
return d;
}
inline string toS(int x){
    char buff[20];
    sprintf(buff,"%d",x);
return (string)buff;
}

inline bool curcularPrime(int x){
    string num = toS(x);
    for(int i=0,len=LN(num)-1; i<len;++i ){
        string temp = num.substr(1)+num[0];
        int number = toI(temp);
        if( ( (number&1)==0 ) || ( good[number]==0 ) ){
            return false;
        }
        num = temp;
    }
return true;
}
inline void sieve(){
    SET(good,-1);
    SET(primes,0);
    int sqrtN = (int)sqrt( (double)inf );
    for(int i=3; i<=sqrtN; i+=2){
        if( good[i]!=0 ){
            for(int j=i*i ; j<=inf ; j+=i ){
                good[j]=0;
            }
        }
    }
    for(int i=101; i<=inf; i+=2 ){
        if( (i&1)==0 || good[i]==0 )continue;
        if( curcularPrime(i) ){
            primes[i]=1;
        }
    }
}
inline void store(){
    int total=0;
    for(int i=0;i<=inf;++i){
        if(primes[i]==1){
            ++total;
        }
        curcular_primes[i]=total;
    }
}
inline void Proc(){
    int var = curcular_primes[ed]-curcular_primes[st-1];

    if( var==0 ){
        cout<<"No Circular Primes.\n";
    }
    else if( var==1 ){
        cout<<"1 Circular Prime.\n";
    }
    else{
        cout<<var<<" Circular Primes.\n";
    }
}
int main(){
//    #ifndef ONLINE_JUDGE
//        freopen("in.txt","rt",stdin);
//    #endif
    sieve();
    store();
    while( scanf("%d",&st)==1 && st!=-1 ){
        CI(ed);
        Proc();
    }

return 0;
}
